package ThreadDemo2;

/**
 * @Author Zhang Chao
 * @Date 2021/6/1 19:42
 * @Version 1.0
 */

//生产者
public class ProducerThread extends Thread{

    public MyStack myStack;

    public ProducerThread(MyStack myStack) {
        this.myStack = myStack;
    }

    @Override
    public void run(){
        for(;;){
            Goods goods = new Goods("商品",10.5);
            myStack.push(goods);
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
